<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>艾美思普智能助手</title>
    
<!-- 在 </head> 标签前添加 -->
<style>
    /* 添加表单相关样式 */
    .form-button {
        background-color: #4CAF50;
        color: white;
        border: none;
        padding: 5px 10px;
        border-radius: 4px;
        cursor: pointer;
        margin-left: 10px;
    }
    
    .form-button:hover {
        background-color: #45a049;
    }
    
    .form-controls {
        margin-top: 10px;
        text-align: center;
    }
</style>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f5f5f5;
        }

        .container {
            max-width: 1200px;
            margin: 20px auto;
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            overflow: hidden;
        }

        .chat-header {
            background-color: #4a76a8;
            color: white;
            padding: 15px;
            text-align: center;
        }

        .chat-messages {
            height: 400px;
            overflow-y: auto;
            padding: 15px;
        }

        .message {
            margin-bottom: 15px;
            padding: 10px;
            border-radius: 5px;
            max-width: 70%;
            word-wrap: break-word;
        }

        .user-message {
            background-color: #e3f2fd;
            margin-left: auto;
            text-align: right;
        }

        .bot-message {
            background-color: #f1f1f1;
            margin-right: auto;
        }

        .chat-input {
            display: flex;
            padding: 15px;
            border-top: 1px solid #ddd;
        }

        .chat-input input {
            flex: 1;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            margin-right: 10px;
        }

        .chat-input button {
            padding: 10px 15px;
            background-color: #4a76a8;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }

        .chat-input button:hover {
            background-color: #3a5a78;
        }

        .conversation-controls {
            display: flex;
            justify-content: center;
            margin-top: 10px;
        }

        .conversation-controls button {
            padding: 5px 10px;
            background-color: #3a5a78;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            margin-right: 10px;
        }

        .conversation-controls select {
            padding: 5px;
            border-radius: 4px;
            border: 1px solid #ddd;
            min-width: 200px;
        }

        .error-message {
            color: #d32f2f;
            background-color: #ffebee;
            padding: 10px;
            border-radius: 4px;
            margin: 10px 0;
            border-left: 4px solid #d32f2f;
        }

        .status-indicator {
            display: inline-block;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            margin-right: 5px;
        }

        .status-online {
            background-color: #4caf50;
        }

        .status-error {
            background-color: #f44336;
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="chat-header">
            <h2>艾美思普智能助手</h2>
            <div class="conversation-controls">
                <button id="newConversationBtn">新建会话</button>
                <select id="conversationSelector">
                    <option value="">-- 选择历史会话 --</option>
                </select>
                <span id="apiStatus" title="API连接状态"><span class="status-indicator status-online"></span></span>
            </div>
        </div>
        <div class="chat-messages" id="chatMessages"></div>
        <div class="chat-input">
            <input type="text" id="messageInput" placeholder="输入消息...">
            <button id="sendButton">发送</button>
        </div>
    </div>

<!-- 在 <body> 标签内，在 .container 元素后添加 -->
    <div class="form-container" id="formContainer" style="display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 80%; height: 80%; background: white; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 1000; overflow: hidden;">
        <iframe id="leaveForm" src="http://192.168.110.16:8080/main/renshi/kaoqing/qingjia" width="100%" height="100%" style="border: none;"></iframe>
    </div>
    
    <div class="form-controls">
        <button id="toggleFormBtn" class="form-button">显示/隐藏表单</button>
    </div>
    
    <!-- 引入脚本 -->
    <script src="/assets/js/form-handler.js"></script>
    <script src="/assets/js/coze-chat.js"></script>
</body>
</html>